package edu.cmu.cs.webapp.ioms.ui.wizards.ingredient;

import org.eclipse.jface.wizard.Wizard;

import edu.cmu.cs.webapp.ioms.models.IOMSFactory;
import edu.cmu.cs.webapp.ioms.models.Ingredient;
import edu.cmu.cs.webapp.ioms.models.impl.IOMSFactoryImpl;

public class IngredientWizard extends Wizard {

	private IngreidentMainWizard _generalPage;
	// private IngredientWizardPage _clientPage;
	private boolean _isUpdate;
	private Ingredient _model;

	public IngredientWizard(boolean update, Ingredient model) {
		_isUpdate = update;
		this._model = model;

	}

	@Override
	public void addPages() {
		_generalPage = new IngreidentMainWizard(
				"Ingredient information management Page");
		addPage(_generalPage);

	}

	@Override
	public boolean performFinish() {
		if (_model == null) {
			_model = IOMSFactory.eINSTANCE.createIngredient();
		}

		/*
		 * _model.setProd_name(_genralPage.get)
		 * 
		 * _model.setOrder_date(_generalPage.getOrderDate());
		 * _model.setExpected_shipping_date(_generalPage.getShippingDate());
		 * _model.setShipping_address(_generalPage.getShippingAddress());
		 * _model.setShipping_city(_generalPage.getShippingCity());
		 * _model.setShipping_state(_generalPage.getShippingState());
		 * _model.setShipping_country(_generalPage.getShippingCountry());
		 * _model.setStatus(OrderStatus.get(_generalPage.getStatus()));
		 * 
		 * Client client = _clientPage.getClient(); _model.setClient(client);
		 * 
		 * _model.getItems().addAll(this._itemPage.getItems());
		 */

		_model.setInventory(this._generalPage.get_ingInventory());
		_model.setName(this._generalPage.get_ingName());
		_model.setRemark(this._generalPage.get_remark());
		_model.setUnit_cost(this._generalPage.get_ingUnitCost());

		return true;
	}

	public boolean isUpdate() {
		return _isUpdate;
	}

	public Ingredient getModel() {
		return this._model;
	}

}
